//var flag=true;
function submitRegister(){
	for(var i=0;i<5;i++){
		if(document.forms.regForm[i].value==""){
			document.getElementById("error").innerHTML="Some fields are empty. Please enter all fields";
			return;
		}
	}
	document.forms["regForm"].submit();
	
}

function checkEmail(){
	var request=new XMLHttpRequest();
	request.onreadystatechange=function(){
		if(request.readyState==4){
			if(!(request.status==200)){
				document.getElementById("error").innerHTML="This email is already exist";
				document.getElementById("regButton").disabled=true;
				return;
			}
		}
	};
	document.getElementById("regButton").disabled=false;
	request.open("GET","RegisterHandler?email="+document.getElementById("email").value,true);
	request.send();
}

function cleanElement(){
	document.getElementById("error").innerHTML="";
}